import json
import requests
def poemmake(text,index=0):
    request_url = 'https://aip.baidubce.com/rpc/2.0/nlp/v1/poem'
    params_d = dict()
    params_d['text'] = text
    params_d['index'] = index
    params = json.dumps(params_d).encode('utf-8')
    access_token = '24.18c156264044eed43c0f5686eb490329.2592000.1613120716.282335-23488180'
    request_url = request_url + "?access_token=" + access_token
    headers = {'content-type': 'application/json'}
    r= response = requests.post(request_url, data=params, headers=headers)
    return r.json()